/**
 * notify.js - Wrapper for bootstrap-notify.js
 * Copyright (c) 2018 Qweas Bookstore, Ethan Phung. All rights reserved.
 */

const SUCCESS = 0, WARNING = 1, ERROR = 2;
function PushNotification(type, msg) {
	let _type, _icon;
	switch (type) {
	case 0:
		_type = 'success';
		_icon = 'glyphicon glyphicon-ok-sign';
		break;
	case 1:
		_type = 'warning';
		_icon = 'glyphicon glyphicon-alert';
		break;
	case 2:
		_type = 'danger';
		_icon = 'glyphicon glyphicon-remove-sign';
		break;
	default:
		_type = 'info';
		_icon = 'glyphicon glyphicon-info-sign';
		break;
	}
	$.notify({
		message : msg,
		icon : _icon,
		url : '#'
	}, {
		type : _type,
		allow_dismiss : true,
		newest_on_top : true,
		z_index : 1033,
		delay : 3000,
		animate : {
			enter : 'animated fadeInUp',
			exit : 'animated fadeOutUp'
		},
		placement : {
			from : "top",
			align : "center"
		},
		spacing : 5,
		offset : 50
	});
}